package cn.gson.boot.model.pojos;

import javax.persistence.*;
import java.util.List;
import java.util.Objects;

@Entity
@Table(name = "role_", schema = "boot", catalog = "")
public class Role {//角色表
    private int jueId;//角色编号
    private String jueName;//角色名称
    private String jueFz;//角色分组
    private Dept dept;//部门对象
    private List<Sort> gongs;

    @ManyToMany
    @JoinTable(name = "role_sort",
            joinColumns = {@JoinColumn(name="jue_id")},
            inverseJoinColumns = {@JoinColumn(name = "sort_id")})
    public List<Sort> getGongs() {
        return gongs;
    }

    public void setGongs(List<Sort> gongs) {
        this.gongs = gongs;
    }

    @Id
    @Column(name = "jue_id", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY,generator = "seq")
    public int getJueId() {
        return jueId;
    }

    public void setJueId(int jueId) {
        this.jueId = jueId;
    }

    @Basic
    @Column(name = "jue_name", nullable = true, length = 200)
    public String getJueName() {
        return jueName;
    }

    public void setJueName(String jueName) {
        this.jueName = jueName;
    }

    @Basic
    @Column(name = "jue_fz", nullable = true, length = 200)
    public String getJueFz() {
        return jueFz;
    }

    public void setJueFz(String jueFz) {
        this.jueFz = jueFz;
    }

    @ManyToOne
    @JoinColumn(name = "dept_id", referencedColumnName = "dept_id")
    public Dept getDept() {
        return dept;
    }

    public void setDept(Dept dept) {
        this.dept = dept;
    }
}
